package com.itheima.sh.homeWork02;

import java.util.ArrayList;

public class Test {
    public static void main(String[] args) {
        Avengers s = new Avengers(1, "钢铁侠", "男");
        Avengers s1 = new Avengers(2, "美国队长", "男");
        Avengers s2 = new Avengers(3, "黑寡妇", "女");
        Avengers s3 = new Avengers(4, "绿巨人", "男");
        Avengers s4 = new Avengers(5, "雷神", "男");
        Avengers s5 = new Avengers(6, "星云", "女");
        ArrayList<Avengers> list = new ArrayList<>();
        list.add(s);
        list.add(s1);
        list.add(s2);
        list.add(s3);
        list.add(s4);
        list.add(s5);
        for (int i = 0; i < list.size(); i++) {
            if (list.get(i).getSex().equals("男") && list.get(i).getName().length() >= 3) {

                list.remove(i);
                    i--;
            }
        }
        for (int i = 0; i < list.size(); i++) {
            System.out.print(list.get(i).getId());
            System.out.print(list.get(i).getName());
            System.out.println(list.get(i).getSex());
        }
    }
}

